package dao.oc_friend_link;

import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import entitybean.oc_friendly_link.EntityBeanOc_Friend_Link;
import entitybean.oc_news.EntityBeanOc_News;
import entitybean.oc_user_name.EntityBeanOc_User_Name;

public class DaoImpl_Oc_Friend_Link extends HibernateDaoSupport implements Dao_Oc_Friend_Link{
	public void Insert_Oc_Friend_Link(EntityBeanOc_Friend_Link e)
	{
		this.getHibernateTemplate().save(e);
	}
	public void Update_Oc_Friend_Link(EntityBeanOc_Friend_Link e)
	{
		this.getHibernateTemplate().update(e);
	}
	public void Delete_Oc_Friend_Link(String id)
	{
		List<EntityBeanOc_Friend_Link> list=this.getHibernateTemplate().find("from EntityBeanOc_Friend_Link where del='OFF' and id in("+id+")");	
		for(int i=0;i<list.size();i++)
		{
			EntityBeanOc_Friend_Link e=list.get(i);
			e.setDel("ON");
			this.getHibernateTemplate().update(e);
			
		}
	}
	@SuppressWarnings("unchecked")
	public List<EntityBeanOc_Friend_Link> Find_Oc_Friend_Link()
	{
		return this.getHibernateTemplate().find("from EntityBeanOc_Friend_Link where del='OFF' order  by sort desc");
	}
	public EntityBeanOc_Friend_Link Find_EntityBeanOc_Friend_Link_By_ID(
			Integer id) {
		EntityBeanOc_Friend_Link e=new EntityBeanOc_Friend_Link();
		List<EntityBeanOc_Friend_Link> list=this.getHibernateTemplate().find("from EntityBeanOc_Friend_Link where id="+id);
		if(list.size()>0)
		{
			e=list.get(0);
		}
		return e;
	}
}
